<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>通用采集器系统</title>
    <link rel="stylesheet" href="css/first.css">
    <link rel="stylesheet" href="layui/css/layui.css">
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

<body>
    <div id="app">
        <aside style="width: 200px;display:block;float: left;">        
            <header>
                <div class="logobox">
                    <img class="logoimg" src="../huaQingWeb/img/logo.png" alt="" />
                    <h4>华清物联web系统</h4>
                  </div>
            </header>
            <ul class="layui-nav layui-nav-tree" lay-filter="test"
                style="background-color: rgb(10, 50, 104); height: 710px;">
                <!-- 侧边导航: <ul class="layui-nav layui-nav-tree layui-nav-side"> -->
                <li class="layui-nav-item">
                    <span href="javascript:;" class="tiaozhuan" src="systemMsg.html">
                        <img src="img/图标2.jpg" alt="" class="aside-img2">
                        状态
                    </span>
                </li>
                <li class="layui-nav-item">
                    <span href="javascript" class="tiaozhuan" src="congjiDev.html">
                        <img src="img/图标2.jpg" alt="" class="aside-img2">
                        参数设置
                    </span>
                </li>
                <li class="layui-nav-item">
                    <span href="javascript" class="tiaozhuan" src="service.html">
                        <img src="img/图标2.jpg" alt="" class="aside-img2">
                        上报服务
                    </span>
                </li>
                <li class="layui-nav-item">
                    <span href="javascript" class="tiaozhuan" src="systemUpdate.html">
                        <img src="img/图标2.jpg" alt="" class="aside-img2">
                        系统维护
                    </span>
                </li>
            </ul>
        </aside>
        <section style="width: calc(100% - 205px);display:block;float: left;">
            <iframe id="iframe" src="systemMsg.html" frameborder="0"
                style="width: 100%;height:780px;"></iframe>
        </section>
    </div>
</body>
<script src="./layui/layui.js"></script>
<script>
    $(".tiaozhuan").click(function () {
        var src = $(this).attr('src')
        $("#iframe").attr('src', src);
    });
    //     $.get("demo_test.php",function(res,status){
    //     alert("数据: " + res + "\n状态: " + status);
    //     res.data.
    //   });
    layui.use('element', function () {
        var element = layui.element;
        //导航的hover效果、二级菜单等功能，需要依赖element模块
        //导航点击事件
        element.on('nav(demo)', function (elem) {
            layer.msg(elem.text());
        });
    });
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            layuimini = layui.layuimini;

        table.render({
            elem: '#currentTableId',
            url: '../api/table.json',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                { type: "checkbox", width: 50, fixed: "left" },
                { field: 'id', width: 80, title: 'ID', sort: true },
                { field: 'username', width: 80, title: '用户名' },
                { field: 'sex', width: 80, title: '性别', sort: true },
                { field: 'city', width: 80, title: '城市' },
                { field: 'sign', title: '签名', minWidth: 150 },
                { field: 'experience', width: 80, title: '积分', sort: true },
                { field: 'score', width: 80, title: '评分', sort: true },
                { field: 'classify', width: 80, title: '职业' },
                { field: 'wealth', width: 135, title: '财富', sort: true },
                { title: '操作', minWidth: 50, templet: '#currentTableBar', fixed: "right", align: "center" }
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            layer.alert(result, {
                title: '最终的搜索信息'
            });

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });

        // 监听添加操作
        $(".data-add-btn").on("click", function () {

            var index = layer.open({
                title: '添加用户',
                type: 2,
                shade: 0.2,
                maxmin: true,
                shadeClose: true,
                area: ['100%', '100%'],
                content: '/page/table/add.html',
            });
            $(window).on("resize", function () {
                layer.full(index);
            });

            return false;
        });

        // 监听驳回操作
        $(".data-delete-btn").on("click", function () {
            var checkStatus = table.checkStatus('currentTableId')
                , data = checkStatus.data;
            layer.alert(JSON.stringify(data));
        });

        //监听表格复选框选择
        table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });

        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {

                var index = layer.open({
                    title: '通过用户',
                    type: 2,                                                                                                
                    shade: 0.2,
                    maxmin: true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: '/page/table/edit.html',
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
                return false;
            } else if (obj.event === 'delete') {
                layer.confirm('真的驳回行么', function (index) {
                    obj.del();
                    layer.close(index);
                });
            }
        });

    });

</script>

<script type="text/html" id="currentTableBar">
    <a class="layui-btn layui-btn-xs data-count-edit" lay-event="edit">通过</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">驳回</a>
</script>

</html>